package cn.itrip.auth.service;

import cn.itrip.beans.pojo.ItripUser;

/** 
* @Description: Token
* @Author: XiaoKun
* @Date: 2019-01-26 
*/ 
public interface TokenService {
    /**
     * 生成token
     *
     * @param userAgent
     * @param user
     * @return
     * @throws Exception
     */
    public String geterateToken(String userAgent, ItripUser user) throws Exception;

    /**
     * 保存token
     *
     * @param token
     * @param user
     * @throws Exception
     */
    public void save(String token, ItripUser user) throws Exception;


    /**
     * token校验
     *
     * @param userAgent
     * @param token
     * @return
     * @throws Exception
     */
    public boolean validate(String userAgent, String token) throws Exception;

    /**
     * 删除token
     *
     * @param token
     */
    public void delToken(String token);

    /**
     * 置换token
     * @param userAgent
     * @param token
     * @return
     * @throws Exception
     */
    public String reloadToken(String userAgent, String token) throws Exception;
}
